<?php
namespace App\Api\Transformers;

use App\MembersModel;
use League\Fractal\TransformerAbstract;

class MemberTransformer extends TransformerAbstract
{
    public function transform(MembersModel $Member) {
        return [
            '_id' => $Member->_id,
            'id' => $Member->id,
            'name' => $Member->name,
            'sex' => $Member->sex,
            'telphone' => $Member->telphone,
            'car_company'=>isset($item->car->car_company) ? $Member->car->car_company : '',
            'license_plate'=>isset($item->car->license_plate) ? $Member->car->license_plate : '',
            'birthday' => $Member->birthday,
            'created_at'=>(string)$Member->created_at,
            'first_time'=>isset($item->car->first_time) ? $Member->car->first_time : '',
            'integral'=>$Member->integral,
        ];
    }
}